#!/usr/bin/perl
################################################################################
#
# Runs the ePub-to-Kindle converter.
#
#   epub2Kindle.pl <folderContainingEpubFile>
#
# This merely passes the parameters on to the relevant platform-specific
# processing.  We assume that that will be happy with the arguments received
# by the present script.  See those scripts for details of the meaning of the
# arguments.
################################################################################

#-------------------------------------------------------------------------------
use strict;
use warnings;
use Cwd 'abs_path';
use File::Basename;
use File::Path;
use File::Spec;



#-------------------------------------------------------------------------------
my $scriptFolder = dirname(File::Spec->rel2abs( __FILE__ ));
require File::Spec->catfile(abs_path("$scriptFolder/jamieSharedFunctions.pl"));



#-------------------------------------------------------------------------------
my $inputFolder = $ARGV[0];
my $operatingSystem = getOperatingSystem();
my $newScript = File::Spec->catfile(abs_path("$scriptFolder/Create_Kindle_$operatingSystem/epub2Kindle.pl"));



#-------------------------------------------------------------------------------
my $status = system("perl \"$newScript\" $inputFolder");
if (0 != ($status >> 8)) { die "Conversion failed"; }
